//
//  WDG_CustomCircleView.m
//  风雨音乐
//
//  Created by dllo on 16/3/24.
//  Copyright © 2016年 yyx. All rights reserved.
//

#import "TTMusicBaseView.h"



@interface WDG_CustomCircleView ()


@end


@implementation WDG_CustomCircleView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor=[UIColor clearColor];
        self.drawColor=COLOR(252, 79, 67);
        self.drawRad=-M_PI_2;
    }
    return self;
}

-(void)drawRect:(CGRect)rect{
    [super drawRect:rect];
    //NSLog(@"%f",rect.size.width);
    CGContextRef context = UIGraphicsGetCurrentContext();
    //void CGContextAddArc(CGContextRef c,CGFloat x, CGFloat y,CGFloat radius,CGFloat startAngle,CGFloat endAngle, int clockwise)1弧度＝180°/π （≈57.3°） 度＝弧度×180°/π 360°＝360×π/180 ＝2π 弧度
    // x,y为圆点坐标，radius半径，startAngle为开始的弧度，endAngle为 结束的弧度，clockwise 0为顺时针，1为逆时针。
    const CGFloat *drawColors=CGColorGetComponents(self.drawColor.CGColor);
    CGContextSetRGBStrokeColor(context,drawColors[0],drawColors[1],drawColors[2],drawColors[3]);//画笔线的颜色
    CGContextSetLineWidth(context, 3);//线的宽度
    CGContextAddArc(context, self.frame.size.width/2, self.frame.size.height/2, self.frame.size.height/2-1.5, -M_PI_2, self.drawRad, 0); //添加一个圆
    CGContextDrawPath(context, kCGPathStroke); //绘制路径
}

-(void)setDrawRad:(CGFloat)drawRad{
    
    _drawRad=drawRad;
    [self setNeedsDisplay];
}



@end
